﻿using System;

namespace MockingBird.Wsdl.Parser
{
    using System.Xml.Linq;

    /// <summary>
    /// Implements the IWsdlRetriever interface to get locally stored wsdls
    /// that are monolithic in nature
    /// </summary>
    public class LocalSinglePartWsdlRetriever : IWsdlRetriever
    {

        private string url;

        #region IWsdlRetriever Members

        public void Initialize(string wsdlUrl)
        {
            if (String.IsNullOrEmpty(wsdlUrl))
                throw new ArgumentException("wsdlUrl is null or empty.", "wsdlUrl");

            this.url = wsdlUrl;
        }

        public XDocument GetWsdl()
        {
            //TBC: Need some checks on whether the file exists

            XDocument wsdlDoc = XDocument.Load(this.url);
            return wsdlDoc;
        }

        public IWsdlRetrieverSettings Settings
        {
            get;
            set;
        }

        public string ServiceName
        {
            get;
            private set;
        }




        #endregion
    }
}
